//
//  XUScanTwoController.m
//  新浪微博
//
//  Created by xuwenxin on 15-4-9.
//  Copyright (c) 2015年 xuwenxin. All rights reserved.
//

#import "XUScanTwoController.h"

@interface XUScanTwoController ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *LayoutY;
@property (nonatomic, strong) CADisplayLink *link;
@end

@implementation XUScanTwoController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    CADisplayLink *link = [CADisplayLink displayLinkWithTarget:self selector:@selector(update)];
    [link addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
    self.link = link;
}
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:YES];
    self.link.paused = NO;
}



- (void)update{
    NSLog(@"%s",__func__);
    self.LayoutY.constant += 2;
    if (self.LayoutY.constant == 124) {
        self.LayoutY.constant = -124;
    }
}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:YES];
    self.link.paused = YES;
    
}
- (IBAction)close:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}
@end
